<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>默认借阅点</title>
  <link rel="stylesheet" href="css/base.css">
  <link rel="stylesheet" href="css/my.css">
  <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1, user-scalable=no">
  <style>
/*     .search_box{margin-top:1.63rem;} */

/* ul li { */
/*     background-image:url('img/my/tuceng 29@2x.png'); */
/*     background-repeat:no-repeat; */
/* } */

 button {  
        width: 40px;  
/*         padding:8px;   */
        background-color: #428bca;  
        border-color: #357ebd;  
        color: #fff;  
        -moz-border-radius: 10px;  
        -webkit-border-radius: 10px;  
        border-radius: 10px; /* future proofing */  
        -khtml-border-radius: 10px; /* for old Konqueror browsers */  
        text-align: center;  
        vertical-align: middle;  
        border: 1px solid transparent;  
        font-weight: 900;  
        font-size:125%  
      } 
  </style>
</head>
<body>
<div class="header-box">
  <p>小鱼儿借阅点</p>
</div>
<div class="search">
  <div class="search_box">
    <img src="img/index/sousuo(2)@2x.png">
    <input id="searchKeyword" type="text" placeholder="搜索借阅站点">
  </div>
</div>
<div class="setLendSite">
  <div class="setLendSite_box">
<!--     <p>我的常用借阅点</p> -->
		<div id="myLendSite" style="border-bottom: 1px solid  #428bca;display: none;">
		<div style="margin-left: 0.37rem;margin-right: 0.37rem;">
		<p>
		<span ><i id="myPlaceName" style="font-size: 0.3rem"></i> </span>
		<span><button class="btn">默认</button></span> 
		</p>
        <p style="padding-top: 14px; padding-bottom: 14px;">
          <span >地址：<i id="myAddress"></i></span><br>
          <span>营业时间：<i id="myPlaceDesc"></i></span>
		</p>
		</div>
		</div>
    <ul id="setLendSite_box_list">
<!--       <li> -->
<!--         <p><i>小鱼儿共享绘本西二旗点</i><b>2km</b></p> -->
<!--         <p> -->
<!--           <span>地址：西二旗万达广场购物中心三层</span><br> -->
<!--           <span>营业时间：9:00—21:00</span> -->
<!--           <i> ></i> -->
<!--         </p> -->
<!--       </li> -->
<!--       <li> -->
<!--         <p><i>小鱼儿共享绘本西二旗点</i><b>2km</b></p> -->
<!--         <p> -->
<!--           <span>地址：西二旗万达广场购物中心三层</span><br> -->
<!--           <span>营业时间：9:00—21:00</span> -->
<!--           <i> ></i> -->
<!--         </p> -->
<!--       </li> -->
<!--       <li> -->
<!--         <p><i>小鱼儿共享绘本西二旗点</i><b>2km</b></p> -->
<!--         <p> -->
<!--           <span>地址：西二旗万达广场购物中心三层</span><br> -->
<!--           <span>营业时间：9:00—21:00</span> -->
<!--           <i> ></i> -->
<!--         </p> -->
<!--       </li> -->
    </ul>
  </div>
</div>
</body>
<script id="lendSite_show_tmpl" type="text/x-jsrender">
<li id="{{:id}}">
        <p><i style="color:blue;font-weight: 600;">{{:placeName}}</i> 
		<b><i> ></i></b></p>
        <p>
          <span>地址：{{:address}}</span><br>
          <span>营业时间：{{:placeDesc}}</span>
         
        </p>
      </li>
</script>
<script src="js/jquery.js"></script><script src="js/jquery.cookie.js"></script>
<script src="js/base.js?v=base.js?v=20180102"></script>
<script src="js/jsrender.js"></script>
<script>
//   $("#setLendSite_box_list>li").click(function () {
// 	  var id = $(this).attr("id");
//      self.location="lendSiteDetails.html?id="+id;
//   });
  $(document).on('click', '#setLendSite_box_list li', function() {
		var id = $(this).attr("id");
		window.location.href = "lendSiteDetails.html?id="+id;
	}); 
  
  
  $("#searchKeyword").bind("input propertychange", function() { 
		var searchKeyword = $(this).val();
		loadData(searchKeyword);
	});
  
  loadMyData();
  loadData();

  //查询我的默认借阅点
function loadMyData(){
  var firstBorrowId = $.cookie("firstBorrowId");
  if(firstBorrowId != null){
	$.get({
		url : window.baseUrl + "/api/book/borrowPlace/find",
		data : {
			id : firstBorrowId
		},
		success : function(data) {
			var data = data.data;
			if(data != null){
				$("#myPlaceName").text(data.placeName);
				$("#myAddress").text(data.address);
				$("#myPlaceDesc").text(data.placeDesc);
				$("#myLendSite").show();
			}
		}
	});	
 }
  }
  
 // 查询所有借阅点
function loadData(placeName){
	$.get({
		url : window.baseUrl + "/api/book/borrowPlace/findPage",
		data : {
			placeName : placeName,
			pageNum : 1,
			pageSize : 100
		},
		success : function(data) {
			var data = data.data.list;
			$("#setLendSite_box_list").empty();
			var htmlOutput = $.templates("#lendSite_show_tmpl").render(data);
			$("#setLendSite_box_list").html(htmlOutput);
		}
	});
} 
</script>
</html>